package cn.chia.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.chia.back.dao.ICSDAO;
import cn.chia.pojo.Customerservices;
import cn.chia.service.CSService;
@Service
public class CSServiceImpl implements CSService {
	private ICSDAO cSDao;
	
	@Resource(name="CSDAOImpl")
	public void setcSDao(ICSDAO cSDao) {
		this.cSDao = cSDao;
	}
	/*
	 * 于辉  隐藏客服
	 */
	public void delete(Customerservices customerservices) throws Exception {
		cSDao.doUpdate(customerservices);
	}
	/*
	 * 于辉  根据id查找客服
	 */
	public Customerservices findFrontById(Integer id) throws Exception {
		return cSDao.findById(id);
	}
	/*
	 * 于辉  查询所有的客服
	 */
	public List<?> findall() throws Exception {
		return cSDao.findAll();
	}
	/*
	 * 于辉  添加客服
	 */
	public void insert(Customerservices customerservices) throws Exception {
		cSDao.doCreate(customerservices);
	}
	/*
	 * 于辉  修改客服信息
	 */
	public void update(Customerservices customerservices) throws Exception {
		cSDao.doUpdate(customerservices);
	}
	/*
	 * 于辉  根据客服名、密码查找客服
	 */
	public Customerservices findByUserPass(String csname, String password)
			throws Exception {
		List<?> list = cSDao.findByUserPass(csname,password);
		return list.size()>0?(Customerservices)list.get(0):null;
	}

}
